<%@page import="com.sdry.model.llm.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>工位：固化（固化开始）</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/ztree/css/zTreeStyle/zTreeStyle.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/css/w42.css">
	
	<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
	<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
	<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
	<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/assets/ztree/js/jquery.ztree.all.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/assets/ztree/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/assets/ztree/js/jquery.ztree.excheck.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/assets/ztree/js/jquery.ztree.exedit.js"></script>
	<script src="${pageContext.request.contextPath }/js/jyy/w42.js" charset="utf-8"></script>
	<script type="text/javascript">
	var format = "";
	
	//年月日+星期
	function load(){
		format = '${format}';
		var d=new Date(format);
		var day=d.getDate();
		var month=d.getMonth() + 1;
		var year=d.getFullYear();
		var weekday=new Array(7);
		weekday[0]="星期日";
		weekday[1]="星期一";
		weekday[2]="星期二";
		weekday[3]="星期三";
		weekday[4]="星期四";
		weekday[5]="星期五";
		weekday[6]="星期六";
		var b = d.toLocaleTimeString();
		document.getElementById('myTime').innerHTML = year + "年" + month + "月" + day+"日"+"&nbsp;<br>"+weekday[d.getDay()]+b;
	}
	//时分秒
	function mytime(){
		var d=new Date(format);
		var day=d.getDate();
		d.setSeconds(d.getSeconds()+1);
		format = d;
		var month=d.getMonth() + 1;
		var year=d.getFullYear();
		var weekday=new Array(7);
		weekday[0]="星期日";
		weekday[1]="星期一";
		weekday[2]="星期二";
		weekday[3]="星期三";
		weekday[4]="星期四";
		weekday[5]="星期五";
		weekday[6]="星期六";
		var b = d.toLocaleTimeString();
		document.getElementById('myTime').innerHTML = year + "年" + month + "月" + day+"日"+"&nbsp;<br>"+weekday[d.getDay()]+b;
	}
	setInterval(function() {mytime()},1000);
	</script>
</head>

<%
	User people = (User) request.getSession().getAttribute("currentUser");
    String name = null;
    if(people != null){
      name = people.getUserName();
    }
%>
<script type="text/html" id="rowToolbar">
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="back">带回</a>
</script>
<body>
   
   <table style="width: 100%; text-align: center; margin: 0px;" border="1px solid #000">
   		<tr>
   			<td rowspan="2" colspan="2"  width="30%"><img alt="" src="${pageContext.request.contextPath }/img/logo.png" width="60%"></td>
   			<td rowspan="2" colspan="2"  width="30%" style="background-color: #4472C4"><p class="font1">固化工位</p></td>
   			<td colspan="2"  width="20%"><p class="font2" style="background-color: #4472C4; color: #ffffff">操作人</p></td>
   			<td rowspan="2" colspan="2" width="20%" style="background-color: #4472C4;"><a id="myTime"  class="font2"></a><a id="time1" class="font2"></a></td>
   		</tr>
   		<tr>
   			<td class="font2" colspan="2" style="background-color: #4472C4; color: #ffffff" id="people"><%=name%></td>
   		</tr>
   		<tr>
   			<td class="font3" style="width:25%;color: #4472C4;">台车扫码</td>
   			<td class="font3" colspan="2" style="width:20%; color: #4472C4;">今日固化数量(支)</td>
   			<td class="font3" colspan="2" style=" width:20%;color: #4472C4; ">固化时间</td>
   			<td class="font3" colspan="2"style="background-color: #ffffff; width:15% "><span id="cremark5"></span>RH</td>
   			<td class="font3" style="color: #4472C4;width:15% " id="setTime">设定</td>
   		</tr>
   		
   		<tr>
   			<td style="font-family: 微软雅黑; font-size: 36px;line-height: 70px">
   				<input id="tc1" placeholder="扫码输入框" style="width: 99%;border:1px #FFFFFF solid;text-align: center;">
   			</td>
   			<td colspan="2" style="font-family: 微软雅黑; font-size: 36px;; line-height: 70px" id="actualNum"></td>
   			<td colspan="5" rowspan="8">
   				<table align="center" id="table4" style="width: 80%;" border="1">
   					<tr>
   						<td id="A1" style="width: 110px;">
   							<img alt="" src="${pageContext.request.contextPath }/img/agv2.png">
   						</td>
   						<td id="B1"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="C1"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="D1"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="E1"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="F1"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="G1"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   					</tr>
   					<tr>
   						<td id="A2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="B2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="C2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="D2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="E2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="F2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="G2"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   					</tr>
   					<tr>
   						<td id="A3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="B3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="C3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="D3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="E3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="F3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="G3"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   					</tr>
   					<tr>
   						<td id="A4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="B4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="C4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="D4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="E4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="F4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="G4"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   					</tr>
   					<tr>
   						<td id="A5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="B5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="C5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="D5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="E5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="F5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   						<td id="G5"><img alt="" src="${pageContext.request.contextPath }/img/agv2.png"></td>
   					</tr>
   					<!-- <tr>
   						<td id="A3"></td>
   						<td id="B3"></td>
   						<td id="C3"></td>
   						<td id="D3"></td>
   						<td id="E3"></td>
   						<td id="F3"></td>
   						<td id="G3"></td>
   					</tr> -->
   				</table>
   				
   				<table align="center" id="table5" style="width: 70%;margin-top: 20px;">
   					<tr>
   						<td style="background-color: #4472C4;font-size:38px;font-family: 微软雅黑; color: #ffffff">台车总数</td>
   						<td width="15%" style="border-width: 2px;border-style: solid;border-color: #e6e6e6;" id="tc"></td>
   						<td style="background-color: #4472C4;font-size:38px;font-family: 微软雅黑; color: #ffffff">组件总数</td>
   						<td width="15%" style="border-width: 2px;border-style: solid;border-color: #e6e6e6;" id="zc"></td>
   					</tr>
   					<tr>
   						<td colspan="4" style="color: red">固化区台车点位<span>35</span>个</td>
   					</tr>
   					<tr>
   						<td colspan="2" style="background-color: #4472C4;font-size:38px;font-family: 微软雅黑; color: #ffffff;border-width: 10px;border-style: solid;border-color: #ffffff;" id="repair">设备报修</td>
   						<td colspan="2" style="background-color: #4472C4;font-size:38px;font-family: 微软雅黑; color: #ffffff;border-width: 10px;border-style: solid;border-color: #ffffff;" id="bad">配件报检</td>
   					</tr>
   					<tr>
   						<td colspan="2" style="background-color: #4472C4;font-size:38px;font-family: 微软雅黑; color: #ffffff;border-width: 10px;border-style: solid;border-color: #ffffff;" id="technics">工艺卡</td>
   						<td colspan="2" style="background-color: #4472C4;font-size:38px;font-family: 微软雅黑; color: #ffffff;border-width: 10px;border-style: solid;border-color: #ffffff;" id="job">作业管理</td>
   					</tr>
   					<tr>
   						<td colspan="4" style="background-color: #676767;font-size:38px;font-family: 微软雅黑; color: #ffffff;border-width: 10px;border-style: solid;border-color: #ffffff;" id="back">注销</td>
   					</tr>
   				</table>
   			</td>
   		</tr>
   		
   		<tr>
   			<td>
   				<table id="table2" align="center" style="width: 100%">
   					<tr>
   						<td width="10%">序号</td>
   						<td width="20%">台车编码</td>
   						<td width="20%">组件数量</td>
   						<td width="50%">开始时间</td>
   					</tr>
   					<tr>
   						<td>01</td>
   						<td id="c1"></td>
   						<td id="z1"></td>
   						<td id="t1"></td>
   					</tr>
   					<tr>
   						<td>02</td>
   						<td id="c2"></td>
   						<td id="z2"></td>
   						<td id="t2"></td>
   					</tr>
   					<tr>
   						<td>03</td>
   						<td id="c3"></td>
   						<td id="z3"></td>
   						<td id="t3"></td>
   					</tr>
   					<tr>
   						<td>04</td>
   						<td id="c4"></td>
   						<td id="z4"></td>
   						<td id="t4"></td>
   					</tr>
   					<tr>
   						<td>05</td>
   						<td id="c5"></td>
   						<td id="z5"></td>
   						<td id="t5"></td>
   					</tr>
   					<tr>
   						<td>06</td>
   						<td id="c6"></td>
   						<td id="z6"></td>
   						<td id="t6"></td>
   					</tr>
   					<tr>
   						<td>07</td>
   						<td id="c7"></td>
   						<td id="z7"></td>
   						<td id="t7"></td>
   					</tr>
   					<tr>
   						<td>08</td>
   						<td id="c8"></td>
   						<td id="z8"></td>
   						<td id="t8"></td>
   					</tr>
   					<tr>
   						<td>09</td>
   						<td id="c9"></td>
   						<td id="z9"></td>
   						<td id="t9"></td>
   					</tr>
   					<tr>
   						<td>10</td>
   						<td id="c10"></td>
   						<td id="z10"></td>
   						<td id="t10"></td>
   					</tr>
   					<tr>
   						<td>11</td>
   						<td id="c11"></td>
   						<td id="z11"></td>
   						<td id="t11"></td>
   					</tr>
   					<tr>
   						<td>12</td>
   						<td id="c12"></td>
   						<td id="z12"></td>
   						<td id="t12"></td>
   					</tr>
   					<tr>
   						<td>13</td>
   						<td id="c13"></td>
   						<td id="z13"></td>
   						<td id="t13"></td>
   					</tr>
   					<tr>
   						<td>14</td>
   						<td id="c14"></td>
   						<td id="z14"></td>
   						<td id="t14"></td>
   					</tr>
   					<tr>
   						<td>15</td>
   						<td id="c15"></td>
   						<td id="z15"></td>
   						<td id="t15"></td>
   					</tr>
   					<tr>
   						<td>16</td>
   						<td id="c16"></td>
   						<td id="z16"></td>
   						<td id="t16"></td>
   					</tr>
   					<tr>
   						<td>17</td>
   						<td id="c17"></td>
   						<td id="z17"></td>
   						<td id="t17"></td>
   					</tr>
   					<tr>
   						<td>18</td>
   						<td id="c18"></td>
   						<td id="z18"></td>
   						<td id="t18"></td>
   					</tr>
   				</table>
   			</td>
   			<td colspan="2">
   			<table id="table3"  align="center" style="width: 100%">
   					<tr>
   						<td width="10%">序号</td>
   						<td width="20%">台车编码</td>
   						<td width="20%">组件数量</td>
   						<td width="50%">开始时间</td>
   					</tr>
   					<tr>
   						<td>19</td>
   						<td id="c19"></td>
   						<td id="z19"></td>
   						<td id="t19"></td>
   					</tr>
   					<tr>
   						<td>20</td>
   						<td id="c20"></td>
   						<td id="z20"></td>
   						<td id="t20"></td>
   					</tr>
   					<tr>
   						<td>21</td>
   						<td id="c21"></td>
   						<td id="z21"></td>
   						<td id="t21"></td>
   					</tr>
   					<tr>
   						<td>22</td>
   						<td id="c22"></td>
   						<td id="z22"></td>
   						<td id="t22"></td>
   					</tr>
   					<tr>
   						<td>23</td>
   						<td id="c23"></td>
   						<td id="z23"></td>
   						<td id="t23"></td>
   					</tr>
   					<tr>
   						<td>24</td>
   						<td id="c24"></td>
   						<td id="z24"></td>
   						<td id="t24"></td>
   					</tr>
   					<tr>
   						<td>25</td>
   						<td id="c25"></td>
   						<td id="z25"></td>
   						<td id="t25"></td>
   					</tr>
   					<tr>
   						<td>26</td>
   						<td id="c26"></td>
   						<td id="z26"></td>
   						<td id="t26"></td>
   					</tr>
   					<tr>
   						<td>27</td>
   						<td id="c27"></td>
   						<td id="z27"></td>
   						<td id="t27"></td>
   					</tr>
   					<tr>
   						<td>28</td>
   						<td id="c28"></td>
   						<td id="z28"></td>
   						<td id="t28"></td>
   					</tr>
   					<tr>
   						<td>29</td>
   						<td id="c29"></td>
   						<td id="z29"></td>
   						<td id="t29"></td>
   					</tr>
   					<tr>
   						<td>30</td>
   						<td id="c30"></td>
   						<td id="z30"></td>
   						<td id="t30"></td>
   					</tr>
   					<tr>
   						<td>31</td>
   						<td id="c31"></td>
   						<td id="z31"></td>
   						<td id="t31"></td>
   					</tr>
   					<tr>
   						<td>32</td>
   						<td id="c32"></td>
   						<td id="z32"></td>
   						<td id="t32"></td>
   					</tr>
   					<tr>
   						<td>33</td>
   						<td id="c33"></td>
   						<td id="z33"></td>
   						<td id="t33"></td>
   					</tr>
   					<tr>
   						<td>34</td>
   						<td id="c34"></td>
   						<td id="z34"></td>
   						<td id="t34"></td>
   					</tr>
   					<tr>
   						<td>35</td>
   						<td id="c35"></td>
   						<td id="z35"></td>
   						<td id="t35"></td>
   					</tr>
   					<tr>
   						<td height="32px;"></td>
   						<td></td>
   						<td></td>
   						<td></td>
   					</tr>
   				</table>
   			</td>
   		</tr>
   </table>
   
    <div id="peiDivID" hidden="hidden">
   
	   	<div class="demoTable" style="padding:10px 0 0 15px">
			<label class="layui-form-label">配件名称</label>
		    <div class="layui-inline">
		    	<input class="layui-input" name="searchName" id="searchName" placeholder="" style="display: inline; width: 80%">
		    </div>
		    <button class="layui-btn layui-btn-blue" style="margin: 0 0 0 10px" data-type="reload" id="serch"><i class="layui-icon layui-icon-search">  搜索</i></button>
		</div>
		<table class="layui-hide" id="peiList" lay-filter="peiList"></table>
	</div>
   
    <div id="ngDivID" hidden="hidden">
	<form class="layui-form layui-card-body" id="formID" action="${pageContext.request.contextPath}/ng/insert.do">
	  	<input type="hidden" name="istation" value="固化">
	  	<div class="layui-form-item">
			<label class="layui-form-label">条码</label>
			<input class="layui-input" lay-verify="type" type="text" name="icode" id="icode" style="width:200px;">
		</div>
   		<div class="layui-form-item">
   			<div class="layui-inline">
				<label class="layui-form-label">配件名称</label>
				 <div class="layui-input-inline">
					<input class="layui-input" type="text" name="iname" id="iname" lay-verify="iname" style="width:200px;" onclick="pei()">
				</div>
			</div>
			<div class="layui-inline">
				<font style="color:red; font-size: 24px;">*</font>
		    </div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">配件规格</label>
			<div class="layui-input-block">
 				<input class="layui-input"  lay-verify="type" type="text" name="istandard" id="istandard" style="width:200px;">
 			</div>
		</div>
		<div class="layui-form-item"><label class="layui-form-label">配件批次号</label><input class="layui-input" lay-verify="type" type="text" name="ibatch" id="ibatch" style="width:200px;"></div>
		<div class="layui-form-item"><label class="layui-form-label">配件数量</label><input class="layui-input" lay-verify="type" type="text" name="inum" id="inum" style="width:200px;"></div>
  		<div class="layui-form-item">
  			<label class="layui-form-label">异常描述</label>
  			<div class="layui-input-inline" style="width:200px;">
                <input type="text" name="idescription" id="idescription" class="layui-input" style="position:absolute;z-index:2;width:80%;" lay-verify="idescription" onkeyup="search()" autocomplete="off">
		      	<select type="text" id="hc_select"  lay-filter="hc_select" autocomplete="off" class="layui-select" lay-search>
		      	</select>
  			</div>
  			<div class="layui-inline">
				<font style="color:red; font-size: 24px;">*</font>
		    </div>
  		</div>
  		
  		 <div class="layui-form-item">
		    <label class="layui-form-label">是否推送</label>
		    <div class="layui-input-block">
		      <input type="checkbox" name="remark01" lay-skin="switch" lay-text="ON|OFF">
		    </div>
		  </div>
  		
  		<button class="layui-btn layui-btn-blue" lay-submit lay-filter="subform" id="save" style="margin-left:120px; margin-bottom: 20px">提交</button>&emsp;&emsp;&emsp;&emsp;<button type="reset" id="cz" class="layui-btn layui-btn-primary" style="margin-bottom: 20px">重置</button>
	</form>
</div>

<!-- 固化时间设定div -->
<div id="tDivID" hidden="hidden">
	<form class="layui-form layui-card-body" id="tformID" action="${pageContext.request.contextPath}/solid/setTime.do">
		<div class="layui-form-item">
			<label class="layui-form-label">固化时间</label>
			<input class="layui-input" lay-verify="type" type="text" name="time" id="time" style="width:300px;">
		</div>
  		<button class="layui-btn layui-btn-blue" lay-submit lay-filter="tsubform" style="margin-left:160px; margin-bottom: 20px">提交</button>
  		&emsp;&emsp;&emsp;&emsp;
  		<button type="reset" class="layui-btn layui-btn-primary" style="margin-bottom: 20px">重置</button>
	</form>
</div>
</body>
<script type="text/javascript">
$(function(){
    var index;
    /* $("#add").click(function(){ */
    $("body").on("click", "#add", function() {
        //console.log($(this).parents('tr').get(0));
        var rowId = $(this).parents('tr').attr("id");
        //alert(rowId);
        var tbody = document.getElementById("tbody");
        index = tbody.rows.length + 1;
        var tab = document.getElementById('myTable');
        //指定行号
        var rowNumNext = document.getElementById(rowId).rowIndex + 1;
        //在指定行下插入一行
        var tr = tab.insertRow(rowNumNext);
        //给tr设置动态Id和样式
        tr.id = "tr" + index;
        tr.style = "text-align: center";
        //在行下插入列内容
        var cell0 = tr.insertCell(0);
        var cell1 = tr.insertCell(1);
        var cell2 = tr.insertCell(2);
        var cell3 = tr.insertCell(3);
        var cell4 = tr.insertCell(4);

        cell0.innerHTML = '<td><input class="layui-input" id="changeDeviceName" name="changeDeviceName" type="text" style="width:122px; margin-left: 27px; margin-bottom: 15px"></td>';
        cell1.innerHTML = '<td><input class="layui-input" id="deviceVersion" name="deviceVersion" type="text" style="width:122px; margin-left: 27px; margin-bottom: 15px"></td>';
        cell2.innerHTML = '<td><input class="layui-input" id="deviceCount" name="deviceCount" type="text" style="width:122px; margin-left: 27px; margin-bottom: 15px"></td>';
        cell3.innerHTML = '<td><input class="layui-input" id="deviceUnit" name="deviceUnit" type="text" style="width:122px; margin-left: 27px; margin-bottom: 15px"></td>';
        cell4.innerHTML = '<td><i class="layui-icon layui-icon-add-1" id="add" style="font-size: 15px; color: #1E9FFF;"></i><br><i class="layui-icon layui-icon-close" id="recover" style="font-size: 15px; color: #1E9FFF; font-weight: bold;"></i></td>';
    });

    $("body").on("click", "#recover", function() {
        var rowId = $(this).parents('tr').attr("id");
        $("#"+rowId).remove();
    })
});
</script>
<script>
layui.use(['table','layer','upload','form','laydate'], function(){
	  var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
	  var table = layui.table;
	  var layer = layui.layer;
	  var laydate = layui.laydate;
	  var form = layui.form; 
	  /* form.render(); */
	  
	  form.on('select(hc_select)', function (data) {   //选择移交单位 赋值给input框
          $("#idescription").val(data.value);
          $("#hc_select").next().find("dl").css({ "display": "none" });
          form.render();
      });

      window.search = function () {
          var value = $("#idescription").val();
          $("#hc_select").val(value);
          form.render();
          $("#hc_select").next().find("dl").css({ "display": "block" });
          var dl = $("#hc_select").next().find("dl").children();
          var j = -1;
          for (var i = 0; i < dl.length; i++) {
              if (dl[i].innerHTML.indexOf(value) <= -1) {
                  dl[i].style.display = "none";
                  j++;
              }
              if (j == dl.length-1) {
                  $("#hc_select").next().find("dl").css({ "display": "none" });
              }
          }
          
      }
	  
	   var $ = layui.jquery, active = {
		reload:function () {
			var searchName = $("#searchName").val();
			table.reload('contenttable1',{
				method:'get',
				where:{"paname":searchName},
				page:{
					curr:1  //重新从第一页开始
				}
			});
		}
	  }
	  
	  $('.layui-btn').on('click', function(){
	      var type = $(this).data('type');
	      active[type] ? active[type].call(this) : '';
	  });
	  
	  table.render({
		    elem: '#peiList'
		    ,url:'${pageContext.request.contextPath }/partMana/listPagePart.do'
		    ,title: '配件列表'
		    ,id :'contenttable1'
		    ,limits:[10,20,30]
		    ,cols: [[
				      {field:'paname', title:'配件名称',width:200},
				      {field:'panum', title:'配件编号' ,width:150},
				      {field:'pamodel', title:'配件规格',width:200},
				      {field:'paremark1', title:'计量单位',width:100},
				      //{field:'paremark2', title:'包装规格',width:100},
				      {fixed:'right', title:'操作', toolbar: '#rowToolbar', width:80}
				    ]],
		    page: true,
		});
	  
	  table.on('tool(peiList)', function(obj){
			var data = obj.data;
			console.log(obj)
			if(obj.event === 'back'){
				
			    $("#iname").val(obj.data.paname); 
			    $("#istandard").val(obj.data.pamodel); 
			    var id = obj.data.paid;
			    $.ajax({
			    	type:'post',
			    	data: {"id":id},
			    	url:'/solid/selectPcByPaid.do',
			    	success:function(data){
			    		$("#ibatch").val(data); 
			    	}
			    });
			    if($("#iname").val() != null ) {
			    	layer.close(index); 
			    }
			    
			}
		});
	  
	  $.ajax({
	        type: "post",
	        url: "${pageContext.request.contextPath }/json/options.json",
	        dataType: 'JSON',
	        success: function (data) {
	              //设置下拉列表中的值的属性
	       		 $("#hc_select").append('<option value="">请选择</option>'); 
	              for ( var i = 0; i < data.length; i++) {
	            	  //增加下拉列表。
	            	  $("#hc_select").append("<option>"+data[i].name+"</option>");
	            	  form.render('select');
	              }
	        }
	  	});
	  
		//选择文本框
	  $("#tc1").select();  
	  //设备报修
	 $('#repair').click(function(){   
		 layer.open({
	         type: 1 					//Page层类型
	         ,area: ['50%', '83%'] 	//宽  高
	         ,title: '设备报修'
	         ,shade: 0.6 				//遮罩透明度
	         ,maxmin: true 				//允许全屏最小化
	         ,anim: 1 					//0-6的动画形式，-1不开启
	         //,content: $("#addFormID")
	         ,content: '<form class="layui-form" id="addFormID">'+
	         '<table>'+
	         '<tr>'+
	             '<td><label class="layui-form-label left-label" style="margin-top: 20px;width:150px;" >设备编号</label></td>'+
	             '<td>'+
	                 '<div>'+
	                     '<div style="width: 200px; margin-left: 0px; float: left; margin-top: 20px">'+
	                         '<select class="layui-select" id="deviceNo" name="deviceNo" lay-filter="displayInfo" lay-verify="deviceNo">'+
	                             '<option value="">请选择</option>'+
	                         '</select>'+
	                     '</div>'+
	                     '<div style="margin-top: 29px; float: left">'+
	                         '<font style="color:red; font-size: 24px; margin-left: 4px">*</font>'+
	                     '</div>'+
	                 '</div>'+
	             '</td>'+ 					
	             '<td><label class="layui-form-label left-label" style="margin-top: 20px;width:150px;">故障设备名称</label></td>'+
	             '<td><input type="text" id="deviceName" name="deviceName" lay-verify="deviceName" class="layui-input" style="width:200px; margin-top: 20px; display: inline;">' +
	                 '<div class="layui-inline" style="margin-top: 4px;">'+
	                     '<font style="color:red; font-size: 24px; margin-left: 4px">*</font>'+
	                 '</div>'+
	             '</td>'+
	         '</tr>'+
	         '<tr style="height:10px"></tr>'+
	         '<tr>'+
	             '<td><label class="layui-form-label left-label" style="width:150px;">报修部门/车间</label></td>'+
	             '<td>'+
	                 '<div>'+
	                     '<div style="width: 200px; margin-left: 0px; float: left">'+
	                         '<select class="layui-select" id="repairDept" name="repairDept" lay-verify="repairDept">'+
	                             '<option value="">请选择</option>'+
	                         '</select>'+
	                     '</div>'+
	                     '<div style="margin-top: 9px; float: left">'+
	                         '<font style="color:red; font-size: 24px; margin-left: 4px">*</font>'+
	                     '</div>'+
	                 '</div>'+
	             '</td>'+
	             '<td><label class="layui-form-label left-label" style="width:150px;">报修人</label></td>'+
	             '<td><input type="text" name="repairMan" id="repairMan" value="<%= name%>" class="layui-input" style="width:200px"></td>'+
	         '</tr>'+
	         '<tr style="height:10px"></tr>'+
	         '<tr>'+
	             '<td><label class="layui-form-label left-label"  style="width:150px;">报修时间</label></td>'+
	             '<td><input type="text" name="repairTime" id="repairTime"  class="layui-input" style="width:200px"></td>'+
	             '<td></td>'+
	             '<td></td>'+
	         '</tr>'+
	         '<tr style="height:10px"></tr>'+
	         '<tr>'+
	             '<td><label class="layui-form-label left-label" style="width:150px;">故障现象描述</label></td>'+
	             '<td colspan="3"><textarea class="layui-textarea" id="errorDescribe" name="errorDescribe" style="width: 540px; height: 150px;"></textarea></td>'+
	         '</tr>'+
	         '<tr style="height:10px"></tr>'+
	         '<tr>'+
	             '<td colspan="2">' +
	                 '<label class="layui-form-label" style="width:150px;">审批人</label>' +
	                 '<input readonly class="layui-input" lay-verify="approvalPeople" placeholder="请选择审批人" name="approvalPeople" id="approvalPeople" type="text" style="width:100px; display:inline; margin-left: 19px">' +
	                 '<i style="font-size:15px;" id="refresh" class="layui-icon layui-icon-refresh"></i>' +
	                 '<ul id="treeConfig" class="ztree" style="margin-left: 120px;"></ul>'+
	             '</td>'+
	             '<td colspan="2">' +
	                 '<label class="layui-form-label" style="width:150px;">抄送人</label>' +
	                 '<input readonly class="layui-input" lay-verify="ccPeople" placeholder="请选择三个抄送人" name ="ccPeople" id="ccPeople" type="text" style="width:200px; display:inline">' +
	                 '<i style="font-size: 15px;" id="dCopyMenRefresh" class="layui-icon layui-icon-refresh"></i>'+
	                 '<ul id="dCopyMenConfig" class="ztree" style="margin-left: 100px;"></ul>'+
	             '</td>'+
	         '</tr>'+
	         '<tr style="height:20px"></tr>'+
	         '<tr align="center">'+
	             '<td colspan="2"><button class="layui-btn layui-btn-blue" id="subBtn" lay-submit lay-filter="addForm" style="margin-left:160px; margin-bottom: 20px">提交</button>&emsp;&emsp;'+
	             '<td colspan="2"><button type="reset" class="layui-btn layui-btn-primary" style="margin-bottom: 20px">重置</button>'+
	         '<tr>'+
	     '</table>'+
	 '</form>'
    
	         ,success: function(){
	             
	        	 var people = $("#people").text();
	         	$("#repairMan").val(people);
	        	 
	        	 //报修时间
	             laydate.render({
	                 elem: '#repairTime'
	             });
	           	//维修起始时间
	             laydate.render({
	                 elem: '#fixStartTime'
	             });
	             //维修结束时间
	             laydate.render({
	                 elem: '#fixEndTime'
	             });
	             //验收日期
	             laydate.render({
	                 elem: '#acceptTime'
	             });
	           	//下拉查找所有设备
	             $.ajax({
		  	            type: 'POST',
		  	            url: '${pageContext.request.contextPath}/device/queryAllDeviceList.do',
		  	            dataType: 'json',
		  	            async: false,
		  	            success: function (data){
		  	                for (var i = 0; i < data.length; i++) {
		  	                    $("#deviceNo").append("<option value='"+ data[i].deviceNo +"'>"+ data[i].deviceNo +"</option>");
		  	                }
		  	            }
		  	        });
	           	//下拉框查找所有部门
					$.ajax({
			            type: 'POST',
			            url: '${pageContext.request.contextPath}/device/queryAllDeptList.do',
			            dataType: 'json',
			            async: false,
			            success: function (data){
			                for (var i = 0; i < data.length; i++) {
			                    $("#repairDept").append("<option value='"+ data[i].name +"'>"+ data[i].name +"</option>");
			                }
			            }
			        });
	           	
	           	
					 $("#refresh").click(function(){
			                $("#approvalPeople").val("");
			            })
			            $("#dCopyMenRefresh").click(function(){
			                $("#ccPeople").val("");
			            })

			            var setting = {
			                isSimpleData : true,             //数据是否采用简单 Array 格式，默认false
			                treeNodeKey : "id",              //在isSimpleData格式下，当前节点id属性
			                treeNodeParentKey : "pId",       //在isSimpleData格式下，当前节点的父节点id属性
			                showLine : true,                 //是否显示节点间的连线
			                checkable : true,                //每个节点上是否显示 CheckBox
			                data: {
			                    simpleData: {
			                        enable: true,
			                        idKey: "id",
			                        pIdKey: "pId",
			                        rootPid: "0"
			                    }
			                },
			                callback: {
			                    onDblClick: onDblClick,
			                }
			            };

			            var dCopyMenSetting = {
			                isSimpleData : true,              //数据是否采用简单 Array 格式，默认false
			                treeNodeKey : "id",               //在isSimpleData格式下，当前节点id属性
			                treeNodeParentKey : "pId",        //在isSimpleData格式下，当前节点的父节点id属性
			                showLine : false,                 //是否显示节点间的连线
			                data: {
			                    simpleData: {
			                        enable: true,
			                        idKey: "id",
			                        pIdKey: "pId",
			                        rootPid: "0"
			                    }
			                },
			                callback: {
			                    onDblClick: dCopyMenOnDblClick,
			                }
			            };

			            function onDblClick(e,treeId,treeNode) {

			                selectedNode = treeNode;
			                var name = treeNode.name;
			                var id = treeNode.id;
			                var type = treeNode.type;
			                if(type!="-1"){
			                    var dApprover1 = $("#approvalPeople").val();
			                    var dApprovers = dApprover1.split(",");
			                    for(var i=0;i<dApprovers.length;i++){
			                        if(name==dApprovers[i]){
			                            toastrStyle();
			                            toastr.warning("选择了重复的审批人！")
			                            name = "";
			                        }
			                    }
			                    var dApprover2;
			                    if(dApprover1 == "" && name != ""){
			                        dApprover2 = $("#approvalPeople").val((dApprover1+','+name).substring(1));
			                    }else if(name != ""){
			                        dApprover2 = $("#approvalPeople").val(dApprover1+','+name);
			                    }
			                    var dApprover3 =  $("#approvalPeople").val();
			                    var dApprovers3 = dApprover3.split(",");
			                    var dApprovers3Length = dApprovers3.length;
			                    if(dApprovers3Length>1){
			                        toastr.warning("最多选择1个审批人");
			                        $("#approvalPeople").val(dApprover1);
			                    }
			                }else{
			                    toastrStyle();
			                    toastr.warning("请选择审批人！")
			                }
			            }

			            function dCopyMenOnDblClick(e,treeId,treeNode) {
			                dCopyMenSelectedNode = treeNode;
			                var name = treeNode.name;
			                var id = treeNode.id;
			                var type = treeNode.type;

			                var dCopyMen = $("#ccPeople").val();
			                var dCopyMen = dCopyMen.split(",");
			                for(var i=0;i<dCopyMen.length;i++){
			                    if(name==dCopyMen[i]){
			                        toastrStyle();
			                        toastr.warning("选择了重复的抄送人！")
			                        name = "";
			                    }
			                }
			                if(dCopyMen == "" && name != ""){
			                    dCopyMen = $("#ccPeople").val((dCopyMen+','+name).substring(1));
			                }else if(name != ""){
			                    dCopyMen = $("#ccPeople").val(dCopyMen+','+name);
			                }
			            }

			            $.ajax({
			                type:'get',
			                url:'${pageContext.request.contextPath }/disposeRejects/getZtreeJson.do',
			                dataType:'json',
			                success: function(data){
			                    var	zNodes = data.rows;
			                    $(document).ready(function() {
			                        $.fn.zTree.init($("#treeConfig"), setting, zNodes);
			                    });
			                },
			                error: function(){
			                    toastrStyle();
			                    toastr.error("请求失败");
			                }
			            });

			            $.ajax({
			                type:'get',
			                url:'${pageContext.request.contextPath }/disposeRejects/getZtreeJson.do',
			                dataType:'json',
			                success: function(data){
			                    var	dCopyMenzNodes = data.rows;
			                    $(document).ready(function() {
			                        $.fn.zTree.init($("#dCopyMenConfig"), dCopyMenSetting, dCopyMenzNodes);
			                    });
			                },
			                error: function(){
			                    toastrStyle();
			                    toastr.error("请求失败");
			                }
			            });
	           	
	             //初始化radio、select等元素
	             form.render();
	         }
	     });
	  })
	  //注销
	 $('#back').click(function(){   
		 window.location.href="${pageContext.request.contextPath }/logout.do";
	  })
	  
	//工艺卡
 $('#technics').click(function(){  
	window.location.href="${pageContext.request.contextPath }/jumpPage/craftDetails.do";
  })
  
  //作业管理
 $('#job').click(function(){   
	 //传值：工位
	window.location.href="${pageContext.request.contextPath }/jumpPage/workManage.do?positionName=固化";
});
	  
	  //配件报检
	 $('#bad').click(function(){   
		 layer.open({
		   type: 1 					//Page层类型
	  		,area: ['500px', '650px'] 	//宽  高
	  		,title: '配件报检'
	  		,shade: 0.6 				//遮罩透明度
	  		,maxmin: true 				//允许全屏最小化
	  		,anim: 1 					//0-6的动画形式，-1不开启
	  		,content: $("#ngDivID")
	  		,end: function(){
	  			$("#ngDivID").hide();
	  			$("#tc1").select();  
	  		}
	   		,success: function(layero, index){
	   			$("#cz").click();
	   			form.render();
	   			
	   			$("#icode").focus(); 
	   			
		        this.enterEsc = function(event){
		          if(event.keyCode === 13){
		            return false; //阻止系统默认回车事件
		          }
		        }; 
	        	$(document).on('keydown', this.enterEsc);	//监听键盘事件，关闭层
	   	 }
	   });
	  })
	  
	  //固化时间设定
	 $('#setTime').click(function(){   
		 layer.open({
		   type: 1 					//Page层类型
	  		,area: ['500px', '200px'] 	//宽  高
	  		,title: '固化时间设定'
	  		,shade: 0.6 				//遮罩透明度
	  		,maxmin: true 				//允许全屏最小化
	  		,anim: 1 					//0-6的动画形式，-1不开启
	  		,content: $("#tDivID")
	  		,end: function(){
	  			$("#tDivID").hide();
	  		}
	   		,success: function(layero, index){
	        this.enterEsc = function(event){
	          if(event.keyCode === 13){
	            return false; //阻止系统默认回车事件
	          }
	        }; 
	        $(document).on('keydown', this.enterEsc);	//监听键盘事件，关闭层
	   	 }
	   });
	  })
	  
	  table.render({
	    elem: '#tableList'
	    ,url:'${pageContext.request.contextPath }/solid/selectList.do'
	    ,title: '固化列表'
	    ,id :'contenttable'
	    ,width : 675
	    ,limits:[5]
	    ,cols: [[
			      {field:'cremark', title:'台车条码'},
			      {field:'starttime', title:'开始时间'},
			      {field:'cremark2', title:'固化时长'},
			      {fixed:'right', title:'操作', toolbar: '#rowToolbar'}
			    ]],
	    page: true,
	});
	  
	  
	//监听行工具事件
	table.on('tool(tableList)', function(obj){
		var data = obj.data;
		var cremark = obj.data.cremark;
		if(obj.event === 'select'){
	   	layer.open({
			  type: 1 					//Page层类型
			  ,area: ['550px', '450px'] //宽  高
			  ,title: '编辑'
			  ,shade: 0.6 				//遮罩透明度
			  ,maxmin: true 			//允许全屏最小化
			  ,anim: 1 					//0-6的动画形式，-1不开启
			  ,content: '<table class="layui-hide" id="tableList2" lay-filter="tableList2"></table>'
			,success: function(){
				layui.use(['table'], function(){
	                var table = layui.table;
	                table.render({
	                    elem: '#tableList2'
	                    ,url:'${pageContext.request.contextPath }/solid/selectDetail.do?cremark='+cremark
	                    ,limits:[5]
	                    ,title: '组件列表'
	                    ,cols: [[
	                        {field:'stube', title:'组件条码'}
	                        ,{field:'cremark1', title:'绑定时间'}
	                    ]]
	                    ,page: true
	                });
	            });
			}
		 });
		} 
	 });
	 
		//查找带回
		 form.on('select(displayInfo)', function(data){
		 	$.ajax({
		         type: 'POST',
		         url: '${pageContext.request.contextPath}/device/queryDeviceInfoByNo.do',
		         data: {deviceNo:$('#deviceNo').val()},
		         success: function (data){
		         	var device = eval('(' +data+ ')');
		         	$('#deviceName').val(device.deviceName);
		         }
		     });
		 });
	  
		  /**
	      * 设备报修
	      */
	     form.on('submit(addForm)', function (data) {
	    	 $("#subBtn").attr("disabled",true);
	         $.ajax({
	             url : '${pageContext.request.contextPath}/breakdown/addDeviceBreakdown.do',
	             data: $("#addFormID").serialize(),
	             cache : false,
	             type : "post",
	         }).done(
	             function(res) {
	                 if (res > 0) {
	                     toastr.success('报修成功！');
	                     layer.closeAll();
	                 }
	             }
	         ).fail(
	             function(res) {
	                 toastrStyle();
	                 toastr.error('报修失败！');
	                 layer.closeAll();
	             }
	         )
	         return false;
	     });
		  
	 	/**
	      * 新增表单校验
	      */
	     form.verify({
	         //value：表单的值item：表单的DOM对象
	         deviceName: function(value, item){
	             if(value == ''){
	                 return '设备名称不能为空';
	             }
	         },
	         deviceNo: function(value, item){
	             if(value == ''){
	                 return '设备编号不能为空';
	             }
	         },
	         repairDept: function(value, item){
	             if(value == ''){
	                 return '报修部门不能为空';
	             }
	         },
	         iname: function(value, item){
	             if(value == ''){
	                 return '配件名称不能为空';
	             }
	         },
	         idescription: function(value, item){
	             if(value == ''){
	                 return '异常描述不能为空';
	             }
	         },
	     });
	  
		/* 配件报检 */
	  form.on('submit(subform)', function (data) {
		  
		  $("#save").attr("disabled",true);
		  
		  var datas=data.field;
	   	  var action=data.form.action;
	   	  $.ajax({
	   		  url:action,
	   		  data:datas,
	   		  type:"POST",
	   		  dataType:"json",
	   		  success:function(result){
	   			 if(result > 0) {
	   				toastr.success("报检成功！");
	   				layer.closeAll();
	   			 }else {
	   				 toastr.warning("报检失败！");
	   				 return false;
	   			 }
	   		  },
	   	  });
	   	  
	   	  return false;
	  });
		
	  /* 固化时间设定 */	
	  form.on('submit(tsubform)', function (data) {
		  var datas=data.field;
	   	  var action=data.form.action;
	   	  
		  var time = $.trim($("#time").val());
		  var reg = /^\d+(?=\.{0,1}\d+$|$)/
		  
		  if(reg.test(time)) {
			  $.ajax({
		   		  url:action,
		   		  data:datas,
		   		  type:"POST",
		   		  dataType:"json",
		   		  success:function(result){
		   			 if(result > 0) {
		   				toastr.success("添加成功！");
		   				layer.closeAll();
		   				selectTime();
		   			 }else {
		   				 toastr.warning("添加失败！");
		   				 return false;
		   			 }
		   		  },
		   	  });
		  }else {
			  toastr.warning("时间设定请输入正数！");
			  return false;
		  }
	   	  return false;
		  });
	  
	  toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
	  toastr.options.timeOut = '2000'; //自动关闭时间
	});

</script>
</html>